package com.itheima.mArray;

import java.util.Scanner;

/*
  遍历数组求和
 */
public class ArrayDemo05 {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int sum = 0;
        int[] arr = new int[5];
        int temp = 0;
        for (int i = 0; i < arr.length; i++) {
            System.out.println("第" + (i + 1) + "个数为:");
            temp = sc.nextInt();
            if (temp >= 60 && temp <= 100) {
                arr[i] = temp;
            } else {
                i--;
            }
            sum += arr[i];
        }
        System.out.println("和为:" + sum);
    }
}
